UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fXwke+Qo/QA2EmeUo0XnmvspsBjJBohBYqyCnoh8ngc=' 
WHERE 
  key_id = '3bc9b1a1419b1a56bed01309a2788f4796f0ed8dda6691a6a74a2c4799520f9f' 
  AND (
    token = 'fXwke+Qo/QA2EmeUo0XnmvspsBjJBohBYqyCnoh8ngc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051