UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jTunFEY9tSSq41DhL7+3vu3Yw6Wp/OMVF3rVBFXtPtE=' 
WHERE 
  key_id = '52743ab59074301a9cc0a33762cb9620ee889d6eaa102b04ea85df151bc7303b' 
  AND (
    token = 'jTunFEY9tSSq41DhL7+3vu3Yw6Wp/OMVF3rVBFXtPtE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032