UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kCI61PrtdxQqIDzByrFhc6bJGeB9om7sR91on7vk8o4='
WHERE
key_id = 'cb14d3a89c761e0e2eeb152b3d184bebd792313c961c48ea3312b2eadab510cd'
AND (
token = 'kCI61PrtdxQqIDzByrFhc6bJGeB9om7sR91on7vk8o4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)