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