UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'j7tEwOnKvoFBBaWFzrD2eH/7xFbjMgVVg3UbfrGpHb0='
WHERE
key_id = 'ae8112458ca6b13cfb5ef9f242baf2c567a0778a8b98dfaccc9ff7efc9c8e4b8'
AND (
token = 'j7tEwOnKvoFBBaWFzrD2eH/7xFbjMgVVg3UbfrGpHb0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)