UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rVa5euLz4CvqI3Q3ZBRHPid1YWRBmobDIH/fMYEmdQw='
WHERE
key_id = 'aaf990cf056f2381a0721a2755e1eb7c9ce8a96495497c06a570527a6a6b4003'
AND (
token = 'rVa5euLz4CvqI3Q3ZBRHPid1YWRBmobDIH/fMYEmdQw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)