UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6do1BvltBshRPECCoufKfRijbM6nsU8Yv+daKcTsuwI=' 
WHERE 
  key_id = '7211d3e81ec1cd652e585423df001bc2611ae71ece476985529930d2c9a354e6' 
  AND (
    token = '6do1BvltBshRPECCoufKfRijbM6nsU8Yv+daKcTsuwI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029