UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D1iWNL9bcTKzHcmWXi9YAQALUHITstZcJ3sqra/VEac='
WHERE
key_id = 'a5c76c5484f625aa088be2f711a133d9420cfa56231d0caf08e579ed0e373f5f'
AND (
token = 'D1iWNL9bcTKzHcmWXi9YAQALUHITstZcJ3sqra/VEac='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)