UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Xe4gHEJW9dk/6xa7nEZnsof2/fpvUXfXDMlznxJwRuk='
WHERE
key_id = 'ffef0105493ea03222b2dd83fefeba503e3dae8084a0649254be6e592b55baae'
AND (
token = 'Xe4gHEJW9dk/6xa7nEZnsof2/fpvUXfXDMlznxJwRuk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)