UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fB7ABIro2SyEobJvPaC7bCPEm2G22L2ftgo9PwZCgDk=' 
WHERE 
  key_id = '1a2f03c76207ad3061b1c6543867e8ccc1db90b8489db70caf6a5ca787e657fb' 
  AND (
    token = 'fB7ABIro2SyEobJvPaC7bCPEm2G22L2ftgo9PwZCgDk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017