UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'prNyGuEyIWV3XjQEfkrCqL+xpUpDEjw1ChlEiwDQgK0=' 
WHERE 
  key_id = 'df2b55645baf4880be143ab6ad3b1eb7793c1183ccd8d8591f9d92b3c27d417b' 
  AND (
    token = 'prNyGuEyIWV3XjQEfkrCqL+xpUpDEjw1ChlEiwDQgK0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030