UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tp3OWKbrcsd150Qt246t6krqKF9bDUWttrqIfEMEdlk='
WHERE
key_id = '5e2846b7ebc8c3c0f1e079293cc83b0c68bc3070fa1826fe383a15b28e1011a5'
AND (
token = 'tp3OWKbrcsd150Qt246t6krqKF9bDUWttrqIfEMEdlk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)