UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NwiLzwF65kqQpZvs085y27CDRHQIFVqiQvHiiRzAEus=' 
WHERE 
  key_id = '848ec9df4a5dfdd7b5a9b9572a614a0f9bb13902c7bbd2589d4273ece3738142' 
  AND (
    token = 'NwiLzwF65kqQpZvs085y27CDRHQIFVqiQvHiiRzAEus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038