UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HzDbJ8RuhoIO94/jmiKJ8A3TgVyT0GPV4Fe7suxkTUY=' 
WHERE 
  key_id = '379af87c2472245799dc32374060e7c558cea04b899bc89d595c214b001daecf' 
  AND (
    token = 'HzDbJ8RuhoIO94/jmiKJ8A3TgVyT0GPV4Fe7suxkTUY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040