UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mzctxIRGz2VWmSWLSdwHe3sfEV+7BXxvoyjJVBlb47k='
WHERE
key_id = 'a9dff8d17ff879f614b86fdd8ea0666674f7074bff5b7195deb9857642cb7011'
AND (
token = 'mzctxIRGz2VWmSWLSdwHe3sfEV+7BXxvoyjJVBlb47k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)