UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qeFjdCysuBU8j5nX4oSDfEHnrMo0iXHBByAmwrHydMY=' 
WHERE 
  key_id = 'a37e828df3ed5b32bb92d53b078d69f8642dd25842a18db1eb5c164c851e84a6' 
  AND (
    token = 'qeFjdCysuBU8j5nX4oSDfEHnrMo0iXHBByAmwrHydMY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038