UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r9RCH068JrImmmCaY3RPrdm8SgPn4+cbit7CkVWhPCQ='
WHERE
key_id = 'cf69c00d520102a17a21a582f9271ff1a3195763b1dce9b0e21c28cbd034124a'
AND (
token = 'r9RCH068JrImmmCaY3RPrdm8SgPn4+cbit7CkVWhPCQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)