UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QN+kmE3hKHOayN+FbIHkYsDCF8cuRJYy4LIF9q7oX3I='
WHERE
key_id = 'fd223b6fdc427afa02d75e7eefec392e56349abe05af21be5e986cbd33d33b83'
AND (
token = 'QN+kmE3hKHOayN+FbIHkYsDCF8cuRJYy4LIF9q7oX3I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)