UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PIT7cZdHryt2ELXd9GXwdkP3BFc6rmAsy0HAGWWT3zo='
WHERE
key_id = '92bde04cadcc8e5def7b23054748c79556bf173177419f1e2a4dea7223573a29'
AND (
token = 'PIT7cZdHryt2ELXd9GXwdkP3BFc6rmAsy0HAGWWT3zo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)