UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JKdlyr6X5jUVv3oUlC7DGW9K6J58BNEy5uQ4tSAU/gk='
WHERE
key_id = '2965631479db964d794c3155dd46f873caa273fa8a19fc47796105b7cda71c5f'
AND (
token = 'JKdlyr6X5jUVv3oUlC7DGW9K6J58BNEy5uQ4tSAU/gk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)