UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YRpOvKog/2Dj9G14njVCJsr8E8OOtpeWgGkpD5qQ7+0=' 
WHERE 
  key_id = 'eedf02cbd24c56fb5e6312ea66caf00fa4223fd76fc404915692f72137855927' 
  AND (
    token = 'YRpOvKog/2Dj9G14njVCJsr8E8OOtpeWgGkpD5qQ7+0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029