UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Cw4Z36IyJddvPc6lYVmYqznM9j9424IrkcU5N1pjBsc='
WHERE
key_id = 'd549ca70153947f3c44e633819a69cbf23b8bf8ce0fa7a8332c5ba203a76d53a'
AND (
token = 'Cw4Z36IyJddvPc6lYVmYqznM9j9424IrkcU5N1pjBsc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)