UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Te5ijPhaDLBRFkFg9NyVpUvSeRaRQdsR5pFSU1keKvI=' 
WHERE 
  key_id = '954d76a99122573dbdcc68e842022b4c8b536a4d31273c7d72ee2683f5aef521' 
  AND (
    token = 'Te5ijPhaDLBRFkFg9NyVpUvSeRaRQdsR5pFSU1keKvI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037