UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TovG7vUFYsHVt2nNYg9SS9HcBw/T6QauRf0HBOv+O38='
WHERE
key_id = '1a63c477a9179812532c4f4ca369bc17012f57f701576e0516ae01a0b4836d62'
AND (
token = 'TovG7vUFYsHVt2nNYg9SS9HcBw/T6QauRf0HBOv+O38='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)