UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MoIBAuNXHPHuzTyHJ27nTI9fWIQG2OeGHdlrAzIpNPE=' 
WHERE 
  key_id = '4912b231f1f1f59f54f2f47b66c5b35fde27382075f22c026e84ea846c6d2c8d' 
  AND (
    token = 'MoIBAuNXHPHuzTyHJ27nTI9fWIQG2OeGHdlrAzIpNPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026