UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/tnwe7yxqqPjqFmuGYISgZUfl+Xd0xEEQLWfBAsxOfo='
WHERE
key_id = 'e8ae8cc020382c3d8229192b5fc62088bc72ec0df839d8a03947caf8d2ad06fd'
AND (
token = '/tnwe7yxqqPjqFmuGYISgZUfl+Xd0xEEQLWfBAsxOfo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)