UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P0E57BbRp0mic9+4mJid51a2aDZmQQe66yapU+y0iPE=' 
WHERE 
  key_id = '60d9ab5fe56a776fbcbd344b89841e9289f354e1750b0debe0c8f0e946b2c458' 
  AND (
    token = 'P0E57BbRp0mic9+4mJid51a2aDZmQQe66yapU+y0iPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036