UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8dtYOXKWHGKvBCWEqS3RvAioD8T0WlexnbD9WYhCuyU='
WHERE
key_id = '59c04b679a3418693546d5e252cfa326f36de6d6579bc8994bcc3a3d01377464'
AND (
token = '8dtYOXKWHGKvBCWEqS3RvAioD8T0WlexnbD9WYhCuyU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)