UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XEkw92X3B6grF5SXekLVdFxWL247Lf4MPmxWlruerb0='
WHERE
key_id = '90ac8a5fddc54f006e71ef3558af003b78d60c7737ad7123c614f314368aaf6d'
AND (
token = 'XEkw92X3B6grF5SXekLVdFxWL247Lf4MPmxWlruerb0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)