UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P4hXl++prG3zVj/+/qfqoVPcAd2AnakS3/Bzs37ssHU=' 
WHERE 
  key_id = '7f1c3abc3c0d14d1388e5187195238e622c5dbe086666eff7664b445f48316c3' 
  AND (
    token = 'P4hXl++prG3zVj/+/qfqoVPcAd2AnakS3/Bzs37ssHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043