UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jS1BtT+tXWjWUk8qH8xxZxHo64ThearBt6irjvkMcUo='
WHERE
key_id = 'fa2fa185d2b507d173483aed694fea1b3ed36caa4628c7e849f5ae67b10d580f'
AND (
token = 'jS1BtT+tXWjWUk8qH8xxZxHo64ThearBt6irjvkMcUo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)