UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd1dzCfB26xiJxLSiN8m9pqIMOcdlrEcudaPNVZzRQJs='
WHERE
key_id = '25bb859dfb86680384074c566cfb0a07bd0721f36a9949c5c5830ece73f4152a'
AND (
token = 'd1dzCfB26xiJxLSiN8m9pqIMOcdlrEcudaPNVZzRQJs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)