UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mPfY92dH1+tz4XlNc/BdLyYc57cvaYcwXqkcxCqsTUU='
WHERE
key_id = 'c99f7ceb152f18116ce0ce9ab713036c8701bf07af667413db3544d7cfff1cdd'
AND (
token = 'mPfY92dH1+tz4XlNc/BdLyYc57cvaYcwXqkcxCqsTUU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)