UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3bpFawPwhT4wgthEYyuVE73RTwxIwSNBs4dgUyUxXQk='
WHERE
key_id = 'd683375b0932dce592b309b41878dfbe0b01abc08ae878a6dabfead0a783b09d'
AND (
token = '3bpFawPwhT4wgthEYyuVE73RTwxIwSNBs4dgUyUxXQk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)