UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bU2CZVlMQPE7zKZj6IdbguCh31F4uP0SaMuKuxPnUQU=' 
WHERE 
  key_id = '2ad407dbcec1d663e5e729e8be83a489f99d2a23edee253b52babea22462275a' 
  AND (
    token = 'bU2CZVlMQPE7zKZj6IdbguCh31F4uP0SaMuKuxPnUQU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017