UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y5KENIGTcNHyKMa00PDucUxrBAMp8pQ3hsoiKcRJMuA=' 
WHERE 
  key_id = '4ee26df1dd8d759f68e0e1fe580dec791e34d7cd2fec57d8350bfe3c6ed1a920' 
  AND (
    token = 'y5KENIGTcNHyKMa00PDucUxrBAMp8pQ3hsoiKcRJMuA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037