UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sdvjh/oe0wDy1R070a8efTLUFHPSKDVPdn2zdGc4aPM=' 
WHERE 
  key_id = '5992606354cf3c4af3e1bd5c3e877532f93d77c4adda635581c3055259100290' 
  AND (
    token = 'Sdvjh/oe0wDy1R070a8efTLUFHPSKDVPdn2zdGc4aPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049