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

Query time 0.00019