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

Query time 0.00030