UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MHaxQmm6rX1tALonjfyWBRJtUlxzKKK9PB9YE4rkwm0='
WHERE
key_id = '815adb7ef412dc2d2b86ce3677e5707d23abdffe2e3ef64234828336a2886c5a'
AND (
token = 'MHaxQmm6rX1tALonjfyWBRJtUlxzKKK9PB9YE4rkwm0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)