UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KsGi+NUhBIlguxt+/gmi1i2c8EdgA8Aypd8Mg7OzO/g=' 
WHERE 
  key_id = '9016db74a3172707c59e986c83247559278fe5c29d6d14b86c25fbe1326e7edd' 
  AND (
    token = 'KsGi+NUhBIlguxt+/gmi1i2c8EdgA8Aypd8Mg7OzO/g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028