UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fzvnl83hU04ZQVpnfVRz7d15z6G7aeBB75BW+RApMAs=' 
WHERE 
  key_id = '4938af3e58d2e882a44fb3a32ff59a5432bfc7694594b0377442172a6a6658f5' 
  AND (
    token = 'fzvnl83hU04ZQVpnfVRz7d15z6G7aeBB75BW+RApMAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020