UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NmbNHSannj8arnMGEopphS9oTaWhRK2/5XGv8UpTTmY=' 
WHERE 
  key_id = '9894fc60735e29646d42171a10b2a4ec374ee331a9fbf46a7dce6536f88e5210' 
  AND (
    token = 'NmbNHSannj8arnMGEopphS9oTaWhRK2/5XGv8UpTTmY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041