UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mc7w+Yy40DtoNfrsWr7sd+sBrGrDHC6IG7bbXpPdTsY=' 
WHERE 
  key_id = 'd21cdde3eb3a428ab547e79903fbe8f746d344d35c851cc4f517a36c12cc7260' 
  AND (
    token = 'mc7w+Yy40DtoNfrsWr7sd+sBrGrDHC6IG7bbXpPdTsY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025