UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'prHDpi8VwUVdoX+uxYKVXOIsp6X+cO2iap/csnwmZGs=' 
WHERE 
  key_id = 'bdbb3c661cf4aa4470167109217e86c428d512f293d966c6dc082ea7e03f71b3' 
  AND (
    token = 'prHDpi8VwUVdoX+uxYKVXOIsp6X+cO2iap/csnwmZGs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052