UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PS4vxFXkyfSfyV4V2uS+ad9mhhAepM5O0u4wgYAPJ6k='
WHERE
key_id = '48617260676eda4f6bbd8b4c712013647babb3457a1d08347325b4997c6b40a0'
AND (
token = 'PS4vxFXkyfSfyV4V2uS+ad9mhhAepM5O0u4wgYAPJ6k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)