UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YvcpP8tIqKYJESTM8yWgHHsQ6KQX5TkBExY39mAobjo='
WHERE
key_id = '0c964ecab93a90af8ee1f85f9d0f9e00907259028f8a0d3c906522113989595f'
AND (
token = 'YvcpP8tIqKYJESTM8yWgHHsQ6KQX5TkBExY39mAobjo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)