UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TknRCyKpHrQit3Q8o4wibeE6Qw2ahCmQXo5FFkZbhWk=' 
WHERE 
  key_id = '9960706fe2e9a89f1e0b75474895e941645bc193662f0c71dafd9770cb07ce37' 
  AND (
    token = 'TknRCyKpHrQit3Q8o4wibeE6Qw2ahCmQXo5FFkZbhWk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046